package com.macro.mall.Converter;
import com.macro.mall.model.UmsMenu;
import com.macro.mall.vo.UmsMenuVo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

/**
 * @author: TuDou
 * @create: 2024-09-02 14:43
 **/
@Mapper(componentModel = "spring")
public interface UmsMenuConverter {

    /**
     * 获取该类自动生成的实现类的实例
     *
     */
    UmsMenuConverter INSTANCES = Mappers.getMapper(UmsMenuConverter.class);

    /**
     * 这个方法就是用于实现对象属性复制的方法
     *
     * @Mapping 注解 用于定义属性复制规则
     * source 指定源对象属性
     * target指定目标对象属性
     *
     * @param student 这个参数就是源对象，也就是需要被复制的对象
     * @return 返回的是目标对象，就是最终的结果对象
     */
    @Mappings({
            @Mapping(source = "id", target = "id"),
            @Mapping(source = "parentId", target = "parentId"),
            @Mapping(source = "createTime", target = "createTime"),
            @Mapping(source = "title", target = "title"),
            @Mapping(source = "level", target = "level"),
            @Mapping(source = "sort", target = "sort"),
            @Mapping(source = "name", target = "name"),
            @Mapping(source = "icon", target = "icon"),
            @Mapping(source = "hidden", target = "hidden")

    })
    UmsMenuVo toStudentHomeVo(UmsMenu student);





}
